
package com.amazonaws.mws.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;


/**
 * <p>Java class for ReportRequestInfo complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="ReportRequestInfo">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="ReportRequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="ReportType" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="StartDate" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
 *         &lt;element name="EndDate" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
 *         &lt;element name="Scheduled" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *         &lt;element name="SubmittedDate" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
 *         &lt;element name="ReportProcessingStatus" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         &lt;element name="GeneratedReportId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="StartedProcessingDate" type={http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
 *         &lt;element name="CompletedDate" type="{http:/www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * Generated by AWS Code Generator
 * <p/>
 * Wed Feb 18 13:28:59 PST 2009
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ReportRequestInfo", propOrder = {
    "reportRequestId",
    "reportType",
    "startDate",
    "endDate",
    "scheduled",
    "submittedDate",
    "reportProcessingStatus",
    "generatedReportId",
    "startedProcessingDate",
    "completedDate"
})
public class ReportRequestInfo {

    @XmlElement(name = "ReportRequestId", required = true)
    protected String reportRequestId;
    @XmlElement(name = "ReportType", required = true)
    protected String reportType;
    @XmlElement(name = "StartDate", required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar startDate;
    @XmlElement(name = "EndDate", required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar endDate;
    @XmlElement(name = "Scheduled", required = true )
    protected boolean scheduled;
    @XmlElement(name = "SubmittedDate", required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar submittedDate;
    @XmlElement(name = "ReportProcessingStatus", required = true)
    protected String reportProcessingStatus;
    @XmlElement(name = "GeneratedReportId")
    protected String generatedReportId;
    @XmlElement(name = "StartedProcessingDate")
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar startedProcessingDate;
    @XmlElement(name = "CompletedDate")
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar completedDate;

    /**
     * Default constructor
     * 
     */
    public ReportRequestInfo() {
        super();
    }

    /**
     * Value constructor
     * 
     */
    public ReportRequestInfo(final String reportRequestId, 
    		final String reportType, 
    		final XMLGregorianCalendar startDate, 
    		final XMLGregorianCalendar endDate, 
    		final boolean scheduled,
    		final XMLGregorianCalendar submittedDate, 
    		final String reportProcessingStatus,
    		final String generatedReportId,
    		final XMLGregorianCalendar startedProcessingDate,
    		final XMLGregorianCalendar completedDate) {
        this.reportRequestId = reportRequestId;
        this.reportType = reportType;
        this.startDate = startDate;
        this.endDate = endDate;
        this.scheduled = scheduled;
        this.submittedDate = submittedDate;
        this.reportProcessingStatus = reportProcessingStatus;
        this.generatedReportId = generatedReportId;
        this.startedProcessingDate = startedProcessingDate;
        this.completedDate = completedDate;
    }

    /**
     * Gets the value of the reportRequestId property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getReportRequestId() {
        return reportRequestId;
    }

    /**
     * Sets the value of the reportRequestId property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setReportRequestId(String value) {
        this.reportRequestId = value;
    }

    public boolean isSetReportRequestId() {
        return (this.reportRequestId!= null);
    }

    /**
     * Gets the value of the reportType property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getReportType() {
        return reportType;
    }

    /**
     * Sets the value of the reportType property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setReportType(String value) {
        this.reportType = value;
    }

    public boolean isSetReportType() {
        return (this.reportType!= null);
    }

    /**
     * Gets the value of the startDate property.
     * 
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public XMLGregorianCalendar getStartDate() {
        return startDate;
    }

    /**
     * Sets the value of the startDate property.
     * 
     * @param value
     *     allowed object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public void setStartDate(XMLGregorianCalendar value) {
        this.startDate = value;
    }

    public boolean isSetStartDate() {
        return (this.startDate!= null);
    }

    /**
     * Gets the value of the endDate property.
     * 
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public XMLGregorianCalendar getEndDate() {
        return endDate;
    }

    /**
     * Sets the value of the endDate property.
     * 
     * @param value
     *     allowed object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public void setEndDate(XMLGregorianCalendar value) {
        this.endDate = value;
    }

    public boolean isSetEndDate() {
        return (this.endDate!= null);
    }
    
    public boolean isScheduled() {
    	return scheduled;
    }
    
    public boolean isSetScheduled() {
    	return true;
    }
    
    public void setScheduled(boolean scheduled) {
    	this.scheduled = scheduled;
    }
    
    public ReportRequestInfo withScheduled(boolean scheduled) {
    	setScheduled(scheduled);
    	return this;
    }
    
    public String getGeneratedReportId() {
    	return generatedReportId;
    }
    
    public void setGeneratedReportId(String generatedReportId) {
    	this.generatedReportId = generatedReportId;
    }
    
    public boolean isSetGeneratedReportId() {
    	return generatedReportId!=null;
    }
    
    public ReportRequestInfo withGeneratedReportId(String generatedReportId) {
    	setGeneratedReportId(generatedReportId);
    	return this;
    }
    
    public XMLGregorianCalendar getStartedProcessingDate() {
    	return startedProcessingDate;
    }
    
    public void setStartedProcessingDate(XMLGregorianCalendar startedProcessingDate) {
    	this.startedProcessingDate = startedProcessingDate;
    }
    
    public boolean isSetStartedProcessingDate() {
    	return startedProcessingDate!=null;
    }
    
    public ReportRequestInfo withStartedProcessingDate(XMLGregorianCalendar startedProcessingDate) {
    	setStartedProcessingDate(startedProcessingDate);
    	return this;
    }
    
    public XMLGregorianCalendar getCompletedDate() {
    	return completedDate;
    }
    
    public void setCompletedDate(XMLGregorianCalendar completedDate) {
    	this.completedDate = completedDate;
    }
    
    public boolean isSetCompletedDate() {
    	return completedDate!=null;
    }
    
    public ReportRequestInfo withCompletedDate(XMLGregorianCalendar completedDate) {
    	setCompletedDate(completedDate);
    	return this;
    }

    /**
     * Gets the value of the submittedDate property.
     * 
     * @return
     *     possible object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public XMLGregorianCalendar getSubmittedDate() {
        return submittedDate;
    }

    /**
     * Sets the value of the submittedDate property.
     * 
     * @param value
     *     allowed object is
     *     {@link XMLGregorianCalendar }
     *     
     */
    public void setSubmittedDate(XMLGregorianCalendar value) {
        this.submittedDate = value;
    }

    public boolean isSetSubmittedDate() {
        return (this.submittedDate!= null);
    }

    /**
     * Gets the value of the reportProcessingStatus property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getReportProcessingStatus() {
        return reportProcessingStatus;
    }

    /**
     * Sets the value of the reportProcessingStatus property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setReportProcessingStatus(String value) {
        this.reportProcessingStatus = value;
    }

    public boolean isSetReportProcessingStatus() {
        return (this.reportProcessingStatus!= null);
    }

    /**
     * Sets the value of the ReportRequestId property.
     * 
     * @param value
     * @return
     *     this instance
     */
    public ReportRequestInfo withReportRequestId(String value) {
        setReportRequestId(value);
        return this;
    }

    /**
     * Sets the value of the ReportType property.
     * 
     * @param value
     * @return
     *     this instance
     */
    public ReportRequestInfo withReportType(String value) {
        setReportType(value);
        return this;
    }

    /**
     * Sets the value of the StartDate property.
     * 
     * @param value
     * @return
     *     this instance
     */
    public ReportRequestInfo withStartDate(XMLGregorianCalendar value) {
        setStartDate(value);
        return this;
    }

    /**
     * Sets the value of the EndDate property.
     * 
     * @param value
     * @return
     *     this instance
     */
    public ReportRequestInfo withEndDate(XMLGregorianCalendar value) {
        setEndDate(value);
        return this;
    }

    /**
     * Sets the value of the SubmittedDate property.
     * 
     * @param value
     * @return
     *     this instance
     */
    public ReportRequestInfo withSubmittedDate(XMLGregorianCalendar value) {
        setSubmittedDate(value);
        return this;
    }

    /**
     * Sets the value of the ReportProcessingStatus property.
     * 
     * @param value
     * @return
     *     this instance
     */
    public ReportRequestInfo withReportProcessingStatus(String value) {
        setReportProcessingStatus(value);
        return this;
    }
    

    /**
     * 
     * XML fragment representation of this object
     * 
     * @return XML fragment for this object. Name for outer
     * tag expected to be set by calling method. This fragment
     * returns inner properties representation only
     */
    protected String toXMLFragment() {
        StringBuffer xml = new StringBuffer();
        if (isSetReportRequestId()) {
            xml.append("<ReportRequestId>");
            xml.append(escapeXML(getReportRequestId()));
            xml.append("</ReportRequestId>");
        }
        if (isSetReportType()) {
            xml.append("<ReportType>");
            xml.append(escapeXML(getReportType()));
            xml.append("</ReportType>");
        }
        if (isSetStartDate()) {
            xml.append("<StartDate>");
            xml.append(getStartDate() + "");
            xml.append("</StartDate>");
        }
        if (isSetEndDate()) {
            xml.append("<EndDate>");
            xml.append(getEndDate() + "");
            xml.append("</EndDate>");
        }
        if (isSetScheduled()) {
        	xml.append("<Scheduled>");
        	xml.append(isScheduled()+"");
        	xml.append("</Scheduled>");
        }
        if (isSetSubmittedDate()) {
            xml.append("<SubmittedDate>");
            xml.append(getSubmittedDate() + "");
            xml.append("</SubmittedDate>");
        }
        if (isSetReportProcessingStatus()) {
            xml.append("<ReportProcessingStatus>");
            xml.append(escapeXML(getReportProcessingStatus()));
            xml.append("</ReportProcessingStatus>");
        }
        if (isSetGeneratedReportId()) {
        	xml.append("<GeneratedReportId>");
        	xml.append(escapeXML(getGeneratedReportId()));
        	xml.append("</GeneratedReportId>");
        }
        if (isSetStartedProcessingDate()) {
        	xml.append("<StartedProcessingDate>");
        	xml.append(getStartedProcessingDate()+"");
        	xml.append("</StartedProcessingDate>");
        }
        if (isSetCompletedDate()) {
        	xml.append("<CompletedDate>");
        	xml.append(getCompletedDate()+"");
        	xml.append("</CompletedDate>");
        }
        return xml.toString();
    }

    /**
     * 
     * Escape XML special characters
     */
    private String escapeXML(String string) {
        StringBuffer sb = new StringBuffer();
        int length = string.length();
        for (int i = 0; i < length; ++i) {
            char c = string.charAt(i);
            switch (c) {
            case '&':
                sb.append("&amp;");
                break;
            case '<':
                sb.append("&lt;");
                break;
            case '>':
                sb.append("&gt;");
                break;
            case '\'':
                sb.append("&#039;");
                break;
            case '"':
                sb.append("&quot;");
                break;
            default:
                sb.append(c);
            }
        }
        return sb.toString();
    }



    /**
     *
     * JSON fragment representation of this object
     *
     * @return JSON fragment for this object. Name for outer
     * object expected to be set by calling method. This fragment
     * returns inner properties representation only
     *
     */
    protected String toJSONFragment() {
        StringBuffer json = new StringBuffer();
        boolean first = true;
        if (isSetReportRequestId()) {
            if (!first) json.append(", ");
            json.append(quoteJSON("ReportRequestId"));
            json.append(" : ");
            json.append(quoteJSON(getReportRequestId()));
            first = false;
        }
        if (isSetReportType()) {
            if (!first) json.append(", ");
            json.append(quoteJSON("ReportType"));
            json.append(" : ");
            json.append(quoteJSON(getReportType()));
            first = false;
        }
        if (isSetStartDate()) {
            if (!first) json.append(", ");
            json.append(quoteJSON("StartDate"));
            json.append(" : ");
            json.append(quoteJSON(getStartDate() + ""));
            first = false;
        }
        if (isSetEndDate()) {
            if (!first) json.append(", ");
            json.append(quoteJSON("EndDate"));
            json.append(" : ");
            json.append(quoteJSON(getEndDate() + ""));
            first = false;
        }
        if (isSetScheduled()) {
        	if (!first) json.append(", ");
        	json.append(quoteJSON("Scheduled"));
        	json.append(" : ");
        	json.append(quoteJSON(isScheduled()+""));
        	first = false;
        }
        if (isSetSubmittedDate()) {
            if (!first) json.append(", ");
            json.append(quoteJSON("SubmittedDate"));
            json.append(" : ");
            json.append(quoteJSON(getSubmittedDate() + ""));
            first = false;
        }
        if (isSetReportProcessingStatus()) {
            if (!first) json.append(", ");
            json.append(quoteJSON("ReportProcessingStatus"));
            json.append(" : ");
            json.append(quoteJSON(getReportProcessingStatus()));
            first = false;
        }
        if (isSetGeneratedReportId()) {
        	if (!first) json.append(", ");
        	json.append(quoteJSON("GeneratedReportId"));
        	json.append(" : ");
        	json.append(quoteJSON(getGeneratedReportId()));
        	first = false;
        }
        if (isSetStartedProcessingDate()) {
        	if (!first) json.append(", ");
        	json.append(quoteJSON("StartedProcessingDate"));
        	json.append(" : ");
        	json.append(quoteJSON(getStartedProcessingDate()+""));
        	first = false;
        }
        if (isSetCompletedDate()) {
        	if (!first) json.append(", ");
        	json.append(quoteJSON("CompletedDate"));
        	json.append(" : ");
        	json.append(quoteJSON(getCompletedDate()+""));
        	first = false;
        }
        return json.toString();
    }

    /**
     *
     * Quote JSON string
     */
    private String quoteJSON(String string) {
        StringBuffer sb = new StringBuffer();
        sb.append("\"");
        int length = string.length();
        for (int i = 0; i < length; ++i) {
            char c = string.charAt(i);
            switch (c) {
            case '"':
                sb.append("\\\"");
                break;
            case '\\':
                sb.append("\\\\");
                break;
            case '/':
                sb.append("\\/");
                break;
            case '\b':
                sb.append("\\b");
                break;
            case '\f':
                sb.append("\\f");
                break;
            case '\n':
                sb.append("\\n");
                break;
            case '\r':
                sb.append("\\r");
                break;
            case '\t':
                sb.append("\\t");
                break;
            default:
                if (c <  ' ') {
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
                } else {
                sb.append(c);
            }
        }
        }
        sb.append("\"");
        return sb.toString();
    }


}
